import { FC, ReactNode, Suspense } from "react";
const Style: React.CSSProperties = {
  textAlign: "center",
  marginTop: 200,
};
function Load(Com: any) {
  return function Core() {
    return (
      <Suspense fallback={<div style={Style}>loading...</div>}>
        <Com />
      </Suspense>
    );
  };
}
export default Load;

export const LoadSuspense: FC<{
  fallback?: ReactNode;
  children: ReactNode;
}> = ({ children, fallback }) => {
  return (
    <Suspense fallback={fallback || <div style={Style}>加载中...</div>}>
      {children}
    </Suspense>
  );
};
